from data032.Page.Page import Page
from selenium.webdriver.common.by import By
class Page1(Page):
    # 点击首页
    one_ye = (By.LINK_TEXT, '首页')
    def one_ye_01(self):
        self.click(self.one_ye)
    # 输入商品名称
    sp_name = (By.XPATH, '//input[@class="search-input" and @name="keywords"]')
    def sp_name_01(self):
        self.send_keys(self.sp_name, '音乐耳机')
    # 点击搜索
    sousuo = (By.XPATH, '//*[@id="searchForm"]/div[2]/input')
    def hueiche(self):
        self.click(self.sousuo)
    # 点击商品
    sp_lb = (By.XPATH, '/html/body/div[5]/div[2]/div[2]/div[1]/ul/li/div[1]/span/a/img')
    def sp_lb_01(self):
        self.click(self.sp_lb)
    # 点击立即购买
    goumai = (By.ID, 'buy-cart')
    def goumai_01(self):
        self.click(self.goumai)
    # 选择收货地址
    dz = (By.XPATH, '//input[@id="address-55" or @class="radio-select-btn"]')
    def dizhi(self):
        self.click(self.dz)
    # 选择支付方式
    zhifu = (By.XPATH, '//input[@class="radio-select-btn"]')
    def zhifu_01(self):
        self.click(self.zhifu)
    # 点击下一步
    xyb = (By.ID, 'order-button')
    def xyb01(self):
        self.click(self.xyb)
    def test_a3mall_case_02(self):
        self.test_a3mall_case_01()
        self.sleep(4)
        self.one_ye_01()
        self.sleep(1)
        self.sp_name_01()
        self.sleep(1)
        self.hueiche()
        self.sleep(7)
        self.sp_lb_01()
        self.sleep(2)
        self.goumai_01()
        self.sleep(2)
        self.dizhi()
        self.sleep(2)
        self.zhifu_01()
        self.sleep(2)
        self.xyb01()
        self.sleep(4)